#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>

using namespace std;

class Solution {
public:
    int getDis(vector<int>& A, int n) {
        int ret = 0;
        int prevmin = A[0];
        for (int i = 1; i < n; i++)
        {
            prevmin = min(prevmin, A[i]);
            ret = max(ret, A[i] - prevmin);
        }
        return ret;
    }
};